package org.misty.practices.string;

import java.util.ArrayList;

public class StringOOM {
    static String ABC = "abc";

    /**
     * VM Options -Xms100M -Xmx100M
     */
    public static void main(String[] args) throws InterruptedException {
        var list = new ArrayList<String>(10000);
        var a = "A";
        var b = "B";
        var c = "C";
        try {
            while (true) {
                list.add((a + b + c));          //  1946160
//              list.add((a + b + c).intern()); // 14778652
            }
        } catch (Throwable e) {
            System.out.println(list.size());
        }
    }
}
